<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8" import="user.*"%> 
<%@ page import="java.sql.*"%> 

<HEAD><TITLE>Registration</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">

</HEAD>

<BODY leftMargin=0 topMargin=10>

<TABLE cellSpacing=0 cellPadding=0 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <DIV align=center><A href="index.jsp"><IMG height=118 
      src="Pics/restaurantLogo.JPG" width=242 
  border=0></A></DIV></TD></TR></TBODY></TABLE>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<tr><td><table width = 60% align = center>
<%
    	Object UserTypeObject = session.getAttribute("uType");
    	String RestID = null;
		//if the current user is a restaurant
		if (UserTypeObject != null && UserTypeObject.toString().equals("2"))
		{
			Object restIDObject = session.getAttribute("id");	
			//out.println("Restaurant id is : " + session.getAttribute("id"));		
			if (restIDObject!= null)
			{
				RestID = restIDObject.toString();
			%>
			<%=DisplayRestaurantPage.getSelectedRestaurantName(RestID) %>
			<%}
    	}
 %>
</table></td></tr>

<% 
String SaveAdverticement = request.getParameter("SaveAdverticement");
if (SaveAdverticement != null && SaveAdverticement.length() > 0)
{
	String AdvContent = request.getParameter("adv_content");	
	
	%>
	<%=Adverticement.SetRestaurantAdverticement(AdvContent, RestID) %>
	<%} %>

<TR>
    <TD vAlign=top height=60>
    <TABLE cellSpacing=1 cellPadding=3 width="60%" align=center bgColor=#cccccc>
    <tr bgColor=#bbbbbb><td align = center colspan = 5>Profit</td></tr>
    <%=DisplayRestaurantPage.getRestaurantProfitLoss(RestID)%>
    <tr><td></td></tr>
    </TABLE>
    </TD>
      </TR>
      
      <tr><td>
      <form action = "restaurant_account.jsp">
      <TABLE cellSpacing=1 cellPadding=3 width="60%" align=center bgColor=#cccccc>
      <tr bgColor=#bbbbbb><td align = center colspan = 5>The Food Sale</td></tr>
      <tr><td>Keyword : <input name="food_search" type="text" class="input" size="20"></td>
      <td>Order By</td>
      <td><input name = 'Order_By_Price' type = 'radio' class = 'input' value ='Order_By_Price'>Price</td>
      <td><input name = 'Order_By_Sales' type = 'radio' class = 'input' value ='Order_By_Sales'>Sales</td>
      <td><input name = 'Order_By_FoodName' type = 'radio' class = 'input' value ='Order_By_FoodName'>Food Name</td>
      </tr>
      <tr><td><INPUT type=submit value=search name=SubmitFoodSearch></td></tr>  
      </TABLE></form>
      
      <TABLE cellSpacing=1 cellPadding=3 width="60%" align=center bgColor=#eeeeee>
      <%
      	//DBConnector db = DBConnector.getDBConnector();	
		String SubmitFoodSearch = request.getParameter("SubmitFoodSearch");
		if (SubmitFoodSearch != null && SubmitFoodSearch.length() > 0) {
			String food_search = request.getParameter("food_search");
			String Order_By_FoodName = request.getParameter("Order_By_FoodName");
			String Order_By_Restaurant = request.getParameter("Order_By_Restaurant");
			String Order_By_Price = request.getParameter("Order_By_Price");
			String Order_By_Sales = request.getParameter("Order_By_Sales");
		%>
        
        
	<%=DisplayFoodPage.DisplayFoodListForRestaurant(food_search,Order_By_FoodName,Order_By_Restaurant,Order_By_Price,Order_By_Sales,RestID) %>
	<%} %>
		<tr><p><a href="./food_addition.html">Add New Food</a></p></tr>     
      </TABLE>       
      </td></tr>
      
      </TABLE>  
      
      <table align="center" width="100%">
      <tr><td>
      <FORM name="delivery_status" action="restaurant_account.jsp" method=post>
      	<TABLE cellSpacing=1 cellPadding=3 align=center bgColor=#cccccc border=0 height="140" width = "60%">
			<TBODY>
				<tr bgColor=#bbbbbb>
					<td align="center" colspan=3>Update Delivery State</td>
				</tr>
				<tr>
					<td>Types of Order Form</td>
					<td>Customer ID</td>
					<td>Customer Name</td>
				<TR>
					<td>
						<select name="select_status" style="width: 140px">
							<option value="any">any</option>
							<option value="not cooked yet">not cooked yet</option>
							<option value="cooking">cooking</option>
						    <option value="ready to deliver">ready to deliver</option>
							<option value="delivering">delivering</option>
							<option value="done">done</option>
						</select>
					</td>
					<td><input name="cus_ID_search" type="text" class="input" size="20"></td>
					<td><input name="cus_name_search" type="text" class="input"	size="20"></td>
				</TR>
				<TR>
					<TD><INPUT type="submit" value=search name=SubmitSearchOrderForm></TD>
				</TR>
			</TBODY>
		</TABLE>
	</FORM>
	</td>
	</tr>
	
	<tr>
			<td colspan=3>
				<!--  <form action="administrator_account.jsp" method=post>-->
				<form action="./servlet/OrderFormItem" method=post>
					<TABLE cellSpacing=1 cellPadding=3 align=center width = "60%"
						bgColor=#eeeeee>
						<%
							String OrderFormSearchButtonPressed = request.getParameter("SubmitSearchOrderForm");
							if (OrderFormSearchButtonPressed != null
									&& OrderFormSearchButtonPressed.length() > 0) {
								
								String OrderStatus = request.getParameter("select_status");
								String CusID = request.getParameter("cus_ID_search");
								String CusName = request.getParameter("cus_name_search");
						%>
						<%=DisplayOrderForm.displayOrderFormListForRestaurant(RestID, OrderStatus, CusID, CusName) %>
						<%} %>
					</table>
				</form>
			</td>
	</tr>
	
	<tr><td>
	<FORM ACTION="restaurant_account.jsp"> 
				<TABLE align="center" border=1 cellspacing="0" cellpadding="0" bgColor=#929292  width = 60%> 
				<tr><td align = "center">Current Adverticement :</td><td align = "center">Enter New Adverticement :</td></tr>
				
				<tr><td bgcolor = #FFFFFF><%=Adverticement.GetRestaurantAdverticement() %></td><TD><textarea name="adv_content" rows=7 cols=35 value = "default"></textarea></TD> 
				</TR> 
				<TR> 
				<TD colspan=2><TABLE align="center" width="100%" cellspacing="0" cellpadding="0"> 
				<TR> 
				<TD align="center" bgcolor="#cccccc"><input type="submit" value="Save" name = "SaveAdverticement"></TD> 
				
				<TD align="center" bgcolor="#cccccc"><input type="reset" value="Reset"></TD> 
				</TR> 
				</TABLE>				
				</TD> 
				</TR> 				
				</TABLE></FORM>
	</td></tr>
	
	
	<tr><td><table width = 60% align = "center">
	<%=DisplayFoodPage.DisplayBestSellingFood(RestID) %>
	</table>
	</td></tr>
	
	</table>
</BODY>
